<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title></title>
    <link rel="stylesheet" href="./css/reset.css">
    <!-- 当前页css -->
    <link rel="stylesheet" href="./css/my-homework.css">
    <!-- <link rel="stylesheet" href="./css/animate.css"> -->
</head>
<body>
<!-- 父容器 -->
<div class="container">
    <!-- 顶部头 -->
    <div class="top clearfix">
        <div class="back fl">返回</div>
        <div class="title fl">我的作业</div>
    </div>
    <!-- 我的作业内容 -->
    <div class="content">
        <!-- 今天的作业 -->
        <div class="current-homework">
            <h4></h4>
            <p><span class="author"></span>&nbsp; |&nbsp; <span class="upload-time"></span></p>
            <a href="#" class="jump"></a>
        </div>
        <!-- 历史作业 -->
        <ul class="history-home">
            <!-- <li>
                    <div class="content">
                        <div class="time">
                            <span>12-08</span>&nbsp;<span>15:34</span>
                        </div>
                        <div class="homework-desc">
                            <div>
                                <h4>经典A班《格鲁夫系列》-第1周</h4>
                                <p>包政</p>
                            </div>
                            图标状态
                            <button class="doing-homework"></button>
                        </div>
                    </div>
            </li> -->
            <!-- <li>
                <a href="#">
                    <div class="content">
                        <div class="time">
                            <span>12-08</span>&nbsp;<span>15:34</span>
                        </div>
                        <div class="homework-desc">
                            <div>
                                <h4>经典A班《格鲁夫系列》-第1周</h4>
                                <p>包政</p>
                            </div>
                            图标状态
                            <i></i>
                        </div>
                    </div>
                </a>
            </li>
            <li>
                <a href="#">
                    <div class="content">
                        <div class="time">
                            <span>12-08</span>&nbsp;<span>15:34</span>
                        </div>
                        <div class="homework-desc">
                            <div>
                                <h4>经典A班《格鲁夫系列》-第1周</h4>
                                <p>包政</p>
                            </div>
                            图标状态
                            <i></i>
                        </div>
                    </div>
                </a>
            </li> -->
        </ul>
    </div>


</div>

<!-- 移动端适配 -->
<script src="./js/flexible.js"></script>
<script src="./js/jquery.js"></script>
<script src="./js/time-filter.js"></script>
<script src="./js/ajax.js"></script>
<script src="./js/index.js"></script>
<script>
   var getParams = function(data){
       var passData = JSON.parse(data);
       //查询截止到当天，某个学员应该写的作业以及状态
       queryAllWorkFromToday({studentId: passData.studentId}, function (res) {
           console.log(res);
           //今天要做的作业
           var todayHomework = res.data.todayList;

           //今天要做的作业不为空：
           if (todayHomework.length) {
               //题目
               $('.current-homework h4').text(todayHomework.content);
               //作者
               $('.current-homework .author').text(todayHomework.author);
               //时间
               $('.current-homework .upload-time').text(timeDayFilter(todayHomework.planTime));
           } else {
               $('.current-homework').css({
                   'display': 'none'
               });
           }

           //今天之前的作业：
           var beforeHomework = res.data.beforeList;
           for (var i = 0; i < beforeHomework.length; i++) {
               var data = beforeHomework[i];
               $('.history-home').append(
                   '<li>'
                   + ' <div class="content">'
                   + ' 	<div class="time">'
                   + ' 		<span>' + timeFilter(data.planTime) + '</span>'
                   + ' 	</div>'
                   + ' 	<div class="homework-desc">'
                   + ' 		<div>'
                   + ' 			<h4>' + data.content + '</h4>'
                   + ' 			<p>' + data.author + '</p>'
                   + ' 		</div>'
                   + ' 		<!-- 图标状态 -->'
                   + ' 		<button class="doing-homework"></button>'
                   + ' 	</div>'
                   + ' </div>'
                   + '</li>'
               );
               var button = $('.history-home li').eq(i).find('.content .homework-desc>.doing-homework');
               //当天作业未完成
               if (data.workStatus == 'INIT') {
                   button.css({
                       'backgroundImage': 'url("../images/y-write_icon.png")'
                   }).on('click', function () {
                       window.baozitang.open(jumpBaseUrl + 'homework-list.html');
                   });
               } else {
                   //当天作业以完成
                   button.on('click', function () {
                       window.baozitang.open(jumpBaseUrl + 'homework-preview.html');
                   });
               }
           }
       });
       //点击写作业
       jump('.jump', 'homework-list.html');
   }
</script>
<!--<script src="./js/my-homework.js"></script>-->
</body>
</html>
